home *** CD-ROM | disk | FTP | other *** search
- #include <stdlib.h>
-
- #include "random.h"
-
- // Return a pseudo-random number from 0.0 upto,
- // but not including, 1.0.
-
- float Rand0UpTo1(void)
- {
- return rand() / (float)(RAND_MAX + 1.0);
- }
-
- // Return a pseudo-random number between 0.0 and
- // 1.0 inclusive.
-
- float Rand0To1(void)
- {
- return rand() / (float)RAND_MAX;
- }
-
- // Return TRUE at the specified probability.
-
- GABool Flip(float Prob)
- {
- return Rand0To1() <= Prob;
- }
-